<?php
	class BrokerinfoAction extends BaseAction{
		public function index(){
			$v_id = $_GET['v_id'];
			$result = M("vip")->where("v_id=$v_id")->select();
			$this->assign("result",$result);
			
			$tuijian = M("xiezilou")->join("rent ON rent.r_id = xiezilou.x_zulin")->where("x_broker = 1")->limit("6")->select();
			$this->assign("tuijian",$tuijian);

			//写字楼出租
			$rent = M("xiezilou")->join("area ON xiezilou.x_quyu = area.a_id")->where("xiezilou.x_zulin=1 and x_broker=1")->select();
		//	echo M("xiezilou")->getlastsql();
		//	var_dump($rent);exit;
			$this->assign("rent",$rent);

			$area = M('area')->select();
			$areaData = array();
			$disData  = array();
			if(!empty($area))
			{
				foreach($area as $key=>$val)
				{
					$areaData[$key]['a_name']= $val['a_name'];
					$areaData[$key]['a_id']	 = $val['a_id'];
					$count   = M('xiezilou')->where('x_quyu='.$val['a_id'])->count();
					$areaData[$key]['nums'] = $count;			
				}
			}
			
			
			$district = M('district')->select();
			if(!empty($district))
			{
				foreach($district as $key=>$val)
				{
					$disData[$key]['d_name']= $val['d_name'];
					$disData[$key]['d_id']= $val['d_id'];
					$count   = M('xiezilou')->where('x_build_area='.$val['d_id'])->count();
					$disData[$key]['nums'] = !empty($count)?$count:0;
				}				
			}
			$this->assign('areadata',$areaData);
			$this->assign('disdata',$disData);
			$this->display();
		}

		public function info(){
			if($_POST['type']=='1'){
				//写字楼出售
				$xsell = M("xiezilou")->join("area ON xiezilou.x_quyu = area.a_id")->where("xiezilou.x_zulin=2")->limit("6")->select();
				$this->assign("result",$xsell);
				$this->display("sellx");
			}elseif($_POST['type']=='2'){
				//商铺出租
				$srent = M("shangpu")->join("area ON shangpu.s_quyu = area.a_id")->where("shangpu.s_zulin=1")->limit("6")->select();
				//	echo M("xiezilou")->getlastsql();
				//	var_dump($rent);exit;
				$this->assign("result",$srent);
				$this->display("shangpu");
			}elseif($_POST['type']=='3'){
				$ssell = M("shangpu")->join("area ON shangpu.s_quyu = area.a_id")->where("shangpu.s_zulin=2")->limit("6")->select();
				$this->assign("result",$ssell);
				$this->display("shangpu");

			}
		
		}
	
	
	}


?>